#pragma once
#include <cstdint>
#include <memory>
#include "axisgroup/fsm.h"
#include "zuc/nml_intf/zucpos2.h"
namespace axisgroup {
class AxisGroup;
class FsmDisable : public FsmItf
{
public:
    static const uint32_t ENABLE_MIN_TIME_MS = 1000;  //关闭使能后再使能间隔必须大于1s，避免本体硬件损坏.所以必须处于disable状态1s后才能接受使能指令
    static const uint32_t PAYLOAD_CHECK_TIME_MS = 1600;
    static const uint32_t ENABLING_TIME_MS = 20000;

public:
    FsmDisable(AxisGroup* grp);
    void update(bool first);
    void reset();

    virtual int check_payload();
    virtual int handle_enabling();

    AxisGroup* grp_;
    bool sta_has_enabled;

    int allow_enable_timer_ = ENABLE_MIN_TIME_MS;
    int enabling_timer_ = ENABLING_TIME_MS;
    int payload_check_timer_ = PAYLOAD_CHECK_TIME_MS;
};
}  // namespace axisgroup
